﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>后台管理系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="robots" content="nofollow"/>
    <link href="style/adminStyle.css" rel="stylesheet" type="text/css"/>
    <style>
        body {
            width: 100%;
            height: 100%;
            overflow: hidden;
            background: url(images/pc_loginBg.jpg) no-repeat;
            background-size: cover;
            position: absolute;
        }
    </style>
    <script src="js/jquery.js"></script>
    <script src="js/Particleground.js"></script>
    <script>
        $(document).ready(function () {
            $('body').particleground({
                dotColor: 'green',
                lineColor: '#c9ec6e'
            });
            $('.intro').css({
                'margin-top': -($('.intro').height() / 2)
            });
        });
    </script>

</head>
<body>
<section class="loginform">
    <h1>后台管理系统</h1>
    <ul>
        <li>
            <label>账号：</label>
            <input type="text" id="username" class="textBox" placeholder="管理员账号"/>
        </li>
        <li>
            <label>密码：</label>
            <input type="password" id="password" class="textBox" placeholder="登陆密码"/>
        </li>
        <li>
            <input id="login" type="button" value="立即登陆"/>
        </li>
    </ul>
</section>
<script type="text/javascript">
    $(function () {
        $("#login").click(function () {
            $.ajax({
                //请求方式
                type: "post",
                //请求路径
                url: "/cai/login",
                data: {
                    //获取输入账号密码
                    username: $("#username").val(),
                    password: $("#password").val()
                },
                success: function (data) {
                    if (parseInt(data) === 1) {
                        location.href = "index.jsp"
                    }else {
                        location.href = "adminLogin.jsp"
                    }
                },
                error: function (data) {
                    alert("登录失败")
                }
            })
        })
    })
</script>
</body>
</html>